from core.support import set_cutscene
from core.item import Item
from core.action import Action  

class Canteen(Item):
    def __init__(self):
        Item.__init__(self, "canteen")    # do basic initialization for every item
        self.has_water = True
                
        # build list of actions
        self.add_action(DrinkWater)
    
    def get_description(self):
            return "canteen"

# define actions for this item

class DrinkWater(Action):
    def __init__(self):
        Action.__init__(self, "drink_water")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Drink Water"
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "post"
    
    # only works in basement. add cutscene
    def do_action(self,game,room,request):
        if self.item.has_water:
            set_cutscene("You drink from the canteen.")
            ##if health.thirsty == True:
                    
                    #self.item.has_water = False
                    #health.thirsty = False 
                    # need to define health
            #else:
                #set_cutscene("You quenched your thirst for the moment, but have finished off the canteen. Hopefully you didn't drink it too early.")
                #self.item.has_water = False
        else:
            set_cutscene("You already drank from you canteen stupid, it is now empty.")
            self.item.has_water = False
        return